import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ${USER}
 * Date: ${YEAR} —${MONTH} —${DAY}
 * Time: ${TIME}
 */
public class Main {


    /*
    public static void main(String[] args) {

        for (long i = 1; i < 999999999; i++) {
            int count = 0;
            int sum = 0;
            long num1 = i;  // 替罪羊1号
            long num2 = i;  // 替罪羊2号

            while (num1 != 0){      //对于i的值会在第一个while中变化我们就找一个替罪羊来jiuok
                count ++;
                num1 = num1 / 10;
            }

            while (num2 != 0 ){
                sum += Math.pow(num2 % 10 , count);   // 这个地方要注意 count在变化，count是次方
                num2 = num2 /10;
            }
            if (sum == i){
                System.out.println(i+"是水仙花数");
            }
        }

    }
    */

    /*
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int count = 0;
        int num = n;
        while(n != 0){
            n = n & (n-1);
            count ++ ;
        }
        System.out.println(num + "化为二进制中有"+ count + "个1");

    }
    */

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        for (int i = 31; i >= 0; i-=2) {
            System.out.print( ( (n>>>i) & 1 )+ " " );
            
        }
        System.out.println(" ");
        for (int j = 30; j >= 0 ; j-=2) {
            System.out.print( ( (n>>>j) & 1 )+ " ");

        }
    }
    

}